﻿<UserControl x:Class="WpfVkontacteClient.Controls.YouTubeViewer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms" 
			Name="controlVideo" Height="420" Width="600">
	<UserControl.Resources>

		<Storyboard x:Key="OnMouseEnter">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                           Storyboard.TargetName="controlVideo" 
                                           Storyboard.TargetProperty="(FrameworkElement.Height)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:00.8000000" Value="200"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="400"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="400"/>
				<SplineDoubleKeyFrame KeyTime="00:00:02" Value="400"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                           Storyboard.TargetName="controlVideo" 
                                           Storyboard.TargetProperty="(FrameworkElement.Width)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:00.8000000" Value="4"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="4"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="200"/>
				<SplineDoubleKeyFrame KeyTime="00:00:02" Value="400"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>


		<Storyboard x:Key="OnMouseLeave">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                           Storyboard.TargetName="controlVideo" 
                                           Storyboard.TargetProperty="(FrameworkElement.Width)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="400"/>
				<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="200"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="4"/>
				<SplineDoubleKeyFrame KeyTime="00:00:00.8000000" Value="4"/>
				<SplineDoubleKeyFrame KeyTime="00:00:02" Value="0"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
                                           Storyboard.TargetName="controlVideo" 
                                           Storyboard.TargetProperty="(FrameworkElement.Height)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="400"/>
				<SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="400"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="400"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="200"/>
				<SplineDoubleKeyFrame KeyTime="00:00:02" Value="0"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>

		<!-- Brushes -->
		<LinearGradientBrush x:Key="closeBrush" EndPoint="0.513,0.942" StartPoint="0.513,0.26">
			<GradientStop Color="#FFE29548" Offset="0"/>
			<GradientStop Color="#FFC8300F" Offset="1"/>
		</LinearGradientBrush>


		<!-- Gel Button style -->
		<Style TargetType="Button" x:Key="gelButton">
			<Setter Property="FrameworkElement.Width" Value="NaN"/>
			<Setter Property="FrameworkElement.MinWidth" Value="0"/>
			<Setter Property="FrameworkElement.Height" Value="NaN"/>
			<Setter Property="FrameworkElement.MinHeight" Value="30"/>
			<Setter Property="Control.Padding" Value="4,4,4,4"/>
			<Setter Property="FrameworkElement.VerticalAlignment" Value="Center"/>
			<Setter Property="TextElement.Foreground">
				<Setter.Value>
					<SolidColorBrush>#FF7C4400</SolidColorBrush>
				</Setter.Value>
			</Setter>
			<Setter Property="TextElement.FontSize" Value="12"/>
			<Setter Property="TextElement.FontWeight" Value="SemiBold"/>
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate TargetType="Button">
						<Grid Margin="0">
							<Grid x:Name="gridGel"  Background="#00FFFFFF" Visibility="Hidden">
								<Border BorderBrush="#FFFFFFFF" CornerRadius="6,6,6,6" 
                                    BorderThickness="3" Opacity="0.9" >
									<Border.BitmapEffect>
										<BlurBitmapEffect Radius="1" />
									</Border.BitmapEffect>
								</Border>
								<Border BorderBrush="#FFFFFFFF" CornerRadius="6,6,6,6" 
                                    BorderThickness="0,0,0.6,0.6" Opacity="0.7" />
								<Border Margin="1,1,1,1" CornerRadius="6,6,6,6" 
                                    Name="background" Background="{StaticResource closeBrush}">
									<Grid Margin="1,1,1,1" ClipToBounds="True">
										<Grid.RowDefinitions>
											<RowDefinition Height="*" />
											<RowDefinition Height="*" />
										</Grid.RowDefinitions>
										<Border CornerRadius="5" Margin="2" 
                                             Width="{TemplateBinding FrameworkElement.Width}" 
                                             Background="#FFFFFFFF" Opacity="0.2" 
                                             Grid.Row="0" Grid.RowSpan="1">
										</Border>
									</Grid>
								</Border>
								<Border Margin="1,1,1,1" BorderBrush="#FFFFFFFF" CornerRadius="6,6,6,6" 
                                    BorderThickness="5,5,0,0" Opacity="0.3">
									<Border.BitmapEffect>
										<BlurBitmapEffect Radius="1" />
									</Border.BitmapEffect>
								</Border>
								<Border Margin="1,1,1,1" BorderBrush="#FF000000" CornerRadius="6,6,6,6" 
                                    BorderThickness="0,0,0.6,0.6" Opacity="1">
									<Border.BitmapEffect>
										<BlurBitmapEffect Radius="1" />
									</Border.BitmapEffect>
								</Border>
								<ContentPresenter Margin="{TemplateBinding Control.Padding}" 
                                    HorizontalAlignment="Center" 
                                    VerticalAlignment="Center" 
                                    ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" 
                                    Content="{TemplateBinding ContentControl.Content}" />
							</Grid>
							<ContentPresenter x:Name="contOnly" Margin="{TemplateBinding Control.Padding}" 
                                    HorizontalAlignment="Center" VerticalAlignment="Center" 
                                    ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" 
                                    Content="{TemplateBinding ContentControl.Content}" 
                                    Opacity="0.4"/>
						</Grid>
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter TargetName="gridGel" Property="Visibility" Value="Visible"/>
								<Setter TargetName="contOnly" Property="Visibility" Value="Hidden"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

	</UserControl.Resources>
	<DockPanel Margin="0" LastChildFill="True" Background="#ff525252"  Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=Width}" 
			   Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=Height}">
		<Grid Background="Black" DockPanel.Dock="Top" Height="40" Margin="5,5,5,0">
			<Label Content="YouTube Video Viewer" Foreground="White" 
                   FontFamily="Agency FB" FontSize="18" FontWeight="Bold" 
                   VerticalAlignment="Center" Margin="10,0,0,0"/>

			<Button x:Name="btnClose" Margin="25,5,5,5" Content="û" FontFamily="Wingdings" FontSize="18"
                            Width="30" Height="30" Style="{StaticResource gelButton}"
                            Foreground="White" FontWeight="Bold" Click="btnClose_Click" ToolTip="Close Video Viewer"
                            HorizontalAlignment="Right"/>
		</Grid>
		<Grid Background="#ff525252" Margin="5,0,5,5">
			<WebBrowser x:Name="browser" Margin="0" Visibility="Collapsed"/>
		</Grid>
	</DockPanel>
</UserControl>
